// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_TOUCH_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.3.1
// Generated from file `collaboration.ice'

#import <Ice/LocalException.h>
#import <Ice/Stream.h>
#import <Ice/Internal.h>
#import <collaboration.h>


@implementation CollaborationEventConsumer

+(id)objectWithDelegate:(id)delegate
{
    return [[[CollaborationEventConsumer alloc] initWithDelegate:delegate] autorelease];
}

-(void) write__:(id<ICEOutputStream>)os_
{
    [os_ writeTypeId:@"::Collaboration::EventConsumer"];
    [os_ startSlice];
    [os_ endSlice];
    [super write__:os_];
}

-(void) read__:(id<ICEInputStream>)is_ readTypeId:(BOOL)rid_
{
    if(rid_)
    {
        [[is_ readTypeId] release];
    }
    [is_ startSlice];
    [is_ endSlice];
    [super read__:is_ readTypeId:YES];
}

static NSString *CollaborationEventConsumer_ids__[] = 
{
    @"::Collaboration::EventConsumer",
    @"::Ice::Object"
};

+(BOOL)push___:(id<CollaborationEventConsumer>)target current:(ICECurrent *)current is:(id<ICEInputStream>)is_ os:(id<ICEOutputStream>)os_
{
    ICEInternalCheckModeAndSelector(target, ICENormal, @selector(push:current:), current);
    CollaborationMutableEvent *evt = nil;
    @try
    {
        evt = [CollaborationEventHelper ice_readWithStream:is_];
        [target push:evt current:current];
    }
    @finally
    {
        [(id<NSObject>)evt release];
    }
    return YES;
}

static NSString *CollaborationEventConsumer_all__[] =
{
    @"ice_id",
    @"ice_ids",
    @"ice_isA",
    @"ice_ping",
    @"push"
};

-(BOOL) dispatch__:(ICECurrent *)current is:(id<ICEInputStream>)is os:(id<ICEOutputStream>)os
{
    id target__ = [self target__];
    switch(ICEInternalLookupString(CollaborationEventConsumer_all__, sizeof(CollaborationEventConsumer_all__) / sizeof(NSString*), current.operation))
    {
        case 0:
            return [ICEObject ice_id___:(id<ICEObject>)self current:current is:is os:os];
        case 1:
            return [ICEObject ice_ids___:(id<ICEObject>)self current:current is:is os:os];
        case 2:
            return [ICEObject ice_isA___:(id<ICEObject>)self current:current is:is os:os];
        case 3:
            return [ICEObject ice_ping___:(id<ICEObject>)self current:current is:is os:os];
        case 4:
            return [CollaborationEventConsumer push___:(id<CollaborationEventConsumer>)target__ current:current is:is os:os];
        default:
            @throw [ICEOperationNotExistException operationNotExistException:__FILE__
                                                                             line:__LINE__
                                                                             id_:current.id_
                                                                             facet:current.facet
                                                                             operation:current.operation];
    }
}

+(NSString **) staticIds__:(int*)count idIndex:(int*)idx
{
    *count = sizeof(CollaborationEventConsumer_ids__) / sizeof(NSString *);
    *idx = 0;
    return CollaborationEventConsumer_ids__;
}
@end

@implementation CollaborationEventSupplier

+(id)objectWithDelegate:(id)delegate
{
    return [[[CollaborationEventSupplier alloc] initWithDelegate:delegate] autorelease];
}

-(void) write__:(id<ICEOutputStream>)os_
{
    [os_ writeTypeId:@"::Collaboration::EventSupplier"];
    [os_ startSlice];
    [os_ endSlice];
    [super write__:os_];
}

-(void) read__:(id<ICEInputStream>)is_ readTypeId:(BOOL)rid_
{
    if(rid_)
    {
        [[is_ readTypeId] release];
    }
    [is_ startSlice];
    [is_ endSlice];
    [super read__:is_ readTypeId:YES];
}

static NSString *CollaborationEventSupplier_ids__[] = 
{
    @"::Collaboration::EventSupplier",
    @"::Ice::Object"
};

+(BOOL)push___:(id<CollaborationEventSupplier>)target current:(ICECurrent *)current is:(id<ICEInputStream>)is_ os:(id<ICEOutputStream>)os_
{
    ICEInternalCheckModeAndSelector(target, ICENormal, @selector(push:current:), current);
    CollaborationMutableEvent *evt = nil;
    @try
    {
        evt = [CollaborationEventHelper ice_readWithStream:is_];
        [target push:evt current:current];
    }
    @finally
    {
        [(id<NSObject>)evt release];
    }
    return YES;
}

static NSString *CollaborationEventSupplier_all__[] =
{
    @"ice_id",
    @"ice_ids",
    @"ice_isA",
    @"ice_ping",
    @"push"
};

-(BOOL) dispatch__:(ICECurrent *)current is:(id<ICEInputStream>)is os:(id<ICEOutputStream>)os
{
    id target__ = [self target__];
    switch(ICEInternalLookupString(CollaborationEventSupplier_all__, sizeof(CollaborationEventSupplier_all__) / sizeof(NSString*), current.operation))
    {
        case 0:
            return [ICEObject ice_id___:(id<ICEObject>)self current:current is:is os:os];
        case 1:
            return [ICEObject ice_ids___:(id<ICEObject>)self current:current is:is os:os];
        case 2:
            return [ICEObject ice_isA___:(id<ICEObject>)self current:current is:is os:os];
        case 3:
            return [ICEObject ice_ping___:(id<ICEObject>)self current:current is:is os:os];
        case 4:
            return [CollaborationEventSupplier push___:(id<CollaborationEventSupplier>)target__ current:current is:is os:os];
        default:
            @throw [ICEOperationNotExistException operationNotExistException:__FILE__
                                                                             line:__LINE__
                                                                             id_:current.id_
                                                                             facet:current.facet
                                                                             operation:current.operation];
    }
}

+(NSString **) staticIds__:(int*)count idIndex:(int*)idx
{
    *count = sizeof(CollaborationEventSupplier_ids__) / sizeof(NSString *);
    *idx = 0;
    return CollaborationEventSupplier_ids__;
}
@end

@implementation CollaborationEventConsumerPrx

-(void) push:(NSDictionary *)evt
{
    [CollaborationEventConsumerPrx push___:evt prx:self context:nil];
}

-(void) push:(NSDictionary *)evt context:(ICEContext *)ctx_
{
    [CollaborationEventConsumerPrx push___:evt prx:self context:ctx_];
}

+(NSString *) ice_staticId
{
    return @"::Collaboration::EventConsumer";
}

+(void) push___:(NSDictionary *)evt prx:(ICEObjectPrx <CollaborationEventConsumerPrx> *)prx_ context:(ICEContext *)ctx_
{
    id<ICEOutputStream> os_ = [prx_ createOutputStream__];
    id<ICEInputStream> is_ = nil;
    @try
    {
        [CollaborationEventHelper ice_writeWithStream:evt stream:os_];
        [prx_ invoke__:@"push" mode:ICENormal os:os_ is:&is_ context:ctx_];
    }
    @catch(ICEUserException *ex_)
    {
        @throw [ICEUnknownUserException unknownUserException:__FILE__ line:__LINE__ unknown:[ex_ ice_name]];
    }
    @finally
    {
        [os_ release];
        [is_ release];
    }
}
@end

@implementation CollaborationEventSupplierPrx

-(void) push:(NSDictionary *)evt
{
    [CollaborationEventSupplierPrx push___:evt prx:self context:nil];
}

-(void) push:(NSDictionary *)evt context:(ICEContext *)ctx_
{
    [CollaborationEventSupplierPrx push___:evt prx:self context:ctx_];
}

+(NSString *) ice_staticId
{
    return @"::Collaboration::EventSupplier";
}

+(void) push___:(NSDictionary *)evt prx:(ICEObjectPrx <CollaborationEventSupplierPrx> *)prx_ context:(ICEContext *)ctx_
{
    id<ICEOutputStream> os_ = [prx_ createOutputStream__];
    id<ICEInputStream> is_ = nil;
    @try
    {
        [CollaborationEventHelper ice_writeWithStream:evt stream:os_];
        [prx_ invoke__:@"push" mode:ICENormal os:os_ is:&is_ context:ctx_];
    }
    @catch(ICEUserException *ex_)
    {
        @throw [ICEUnknownUserException unknownUserException:__FILE__ line:__LINE__ unknown:[ex_ ice_name]];
    }
    @finally
    {
        [os_ release];
        [is_ release];
    }
}
@end

@implementation CollaborationEventDataHelper
+(id) ice_readWithStream:(id<ICEInputStream>)stream
{
    return [stream readByteSeq];
}

+(void) ice_writeWithStream:(id)obj stream:(id<ICEOutputStream>)stream
{
    [stream writeByteSeq:obj];
}
@end

@implementation CollaborationEventHelper
+(ICEKeyValueTypeHelper) getContained
{
    ICEKeyValueTypeHelper c;
    c.key = [ICEStringHelper class];
    c.value = [CollaborationEventDataHelper class];
    return c;
}
@end
